#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "my_memory.h"

//类静态成员赋值
CMemory *CMemory::m_instance = nullptr;
std::mutex CMemory::m_mutex;

CMemory::CMemory() {}
CMemory::~CMemory() {}

// 分配内存函数
void *CMemory::AllocMemory(int memCount,bool ifmemset){
    void *tmpData = (void *)new char[memCount];
    if(ifmemset){ //要求内存置0
	    memset(tmpData,0,memCount);
    }
	return tmpData;
}

//内存释放函数
void CMemory::FreeMemory(void *point){
    delete [] ((char *)point);// 转换回char*再删除，避免警告
}